home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume16 / lc / patch1 next >
Encoding:
Internet Message Format  |  1991-01-10  |  17.2 KB

  1. From: kent@sparky.imd.sterling.com (Kent Landfield)
  2. Newsgroups: comp.sources.misc
  3. Subject: v16i061:  lc - Categorize and List Files In Columns, Patch1
  4. Message-ID: <1991Jan9.034819.24747@sparky.IMD.Sterling.COM>
  5. Date: 9 Jan 91 03:48:19 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: 9ca2d45a 9244acd3 13e90408 8d30d6eb
  8.  
  9. Submitted-by: kent@sparky.imd.sterling.com (Kent Landfield)
  10. Posting-number: Volume 16, Issue 61
  11. Archive-name: lc/patch1
  12. Patch-To: lc: Volume 14, Issue 82-83
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  19. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  20. # If this archive is complete, you will see the following message at the end:
  21. #        "End of shell archive."
  22. # Contents:  lc.patch
  23. # Wrapped by kent@sparky on Tue Jan  8 21:39:52 1991
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'lc.patch' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'lc.patch'\"
  27. else
  28. echo shar: Extracting \"'lc.patch'\" \(15399 characters\)
  29. sed "s/^X//" >'lc.patch' <<'END_OF_FILE'
  30. Xdiff -c ../lc.old/README ./README
  31. X*** ../lc.old/README    Tue Jan  8 21:23:29 1991
  32. X--- ./README    Tue Jan  8 21:22:27 1991
  33. X***************
  34. X*** 1,23 ****
  35. X  
  36. X              LC
  37. X  
  38. X!         "@(#)README    1.3 9/7/90 Kent Landfield"
  39. X  
  40. X  This directory contains the source to lc. lc is much like the ls 
  41. X  command except it separates the types of files into groups and then
  42. X  displays located file names to the user is a columnar fashion. 
  43. X  
  44. X! lc was initially implemented by myself after I became accustomed
  45. X! to the lc command on a Mark Williams Coherent system I was running back
  46. X! in 1984.  When I started moving to different systems I found that I did
  47. X! not like the lack of information, flexibility and the general display 
  48. X! that ls provided.  I have found that I am not the only one that has 
  49. X! become feed up with ls and its jumbled output. All the people here use 
  50. X! lc much more than they use ls. It is a locally well known fact that when
  51. X! a new machine comes into the house, the first local software that is put 
  52. X! on the machine is lc.  It is far from perfect but it is better than ls on 
  53. X! a general use basis.
  54. X  
  55. X  lc uses three different environment variables COLS, CDPATH, and LC
  56. X  allowing you to customize how you wish lc to perform on a default 
  57. X  basis. COLS is used to switch the column width between 80 and 132 
  58. X--- 1,29 ----
  59. X  
  60. X              LC
  61. X  
  62. X!         "@(#)README    1.4 1/8/91 Kent Landfield"
  63. X  
  64. X  This directory contains the source to lc. lc is much like the ls 
  65. X  command except it separates the types of files into groups and then
  66. X  displays located file names to the user is a columnar fashion. 
  67. X  
  68. X! "lc"'s history goes back to 1978 when it was originally developed at the
  69. X! University of Waterloo on a Honeywell 66/60 system. It became so popular 
  70. X! that it was ported to Waterloo's V7 Unix systems shortly thereafter.  
  71. X! This version is a complete re-implementation of lc and contains no 
  72. X! University of Waterloo code.
  73. X  
  74. X+ This version of lc was initially implemented by myself after I became 
  75. X+ accustomed to the lc command on a Mark Williams Coherent system I was 
  76. X+ running back in 1984.  When I started moving to different systems I 
  77. X+ found that I did not like the lack of information, flexibility and the 
  78. X+ general display that ls provided.  I have found that I am not the only 
  79. X+ one that has become feed up with ls and its jumbled output. All the 
  80. X+ people here use lc much more than they use ls. It is a locally well 
  81. X+ known fact that when a new machine comes into the house, the first local 
  82. X+ software that is put on the machine is lc.  It is far from perfect but 
  83. X+ it is better than ls on a general use basis. 
  84. X+ 
  85. X  lc uses three different environment variables COLS, CDPATH, and LC
  86. X  allowing you to customize how you wish lc to perform on a default 
  87. X  basis. COLS is used to switch the column width between 80 and 132 
  88. X***************
  89. X*** 59,70 ****
  90. X          -l      Mark symbolic links with '@'
  91. X          -I      Suppress unresolved symbolic link messages.
  92. X    
  93. X!    The "only" options can not be combined.
  94. X  
  95. X     If there is no 'directory' specified, the current directory is used.
  96. X  
  97. X     Not all options are supported on every system. (e.g. no symbolic links
  98. X!    on your system ? Options -s, -L or -l won't be available..)
  99. X     If your system does not support shared memory name space entry files, 
  100. X     then you cannot use the -m option...
  101. X  
  102. X--- 65,76 ----
  103. X          -l      Mark symbolic links with '@'
  104. X          -I      Suppress unresolved symbolic link messages.
  105. X    
  106. X!    The "only" options can be combined.
  107. X  
  108. X     If there is no 'directory' specified, the current directory is used.
  109. X  
  110. X     Not all options are supported on every system. (e.g. no symbolic links
  111. X!    on your system ? Options -s, -I -L or -l won't be available..)
  112. X     If your system does not support shared memory name space entry files, 
  113. X     then you cannot use the -m option...
  114. X  
  115. X***************
  116. X*** 87,93 ****
  117. X--- 93,102 ----
  118. X        Tested with SunOS 4.0.3 on a Sparkstation 1 in 1989.
  119. X        Tested with UTek on a Tektronix XD8810 in 1989.
  120. X        Tested with AIX 3.+ on a Risc System/6000 in 1990.
  121. X+       Ivan Fris added the ability to combine "only" options in 1990.
  122. X+       Mike Peterson ported it to the Apollo Domain/OS SR10.2 in 1990.
  123. X  
  124. X+ 
  125. X  The following is a todo list that may get done someday...
  126. X  
  127. X  1. Port to all flavors of unix on all platforms. Lofty goal but
  128. X***************
  129. X*** 95,101 ****
  130. X  2. Need to modify lc so that one environment (or compile) option will
  131. X     only let you see files you own or have access to.
  132. X  3. Add spell checking code to CDPATH usage
  133. X- 4. Allow combination of only options...
  134. X                                                          
  135. X                            *PLEASE!* 
  136. X  If you have a problem, there's someone else out there who either has
  137. X--- 104,109 ----
  138. X***************
  139. X*** 102,108 ****
  140. X  had or will have the same problem.  Please send all "lc" ideas, patches, 
  141. X  etc to 
  142. X  
  143. X! INTERNET: kent@sparky.IMD.Sterling.COM or UUCP: uunet!ssbell!sparky!kent
  144. X  
  145. X  so that I can continue to improve the functionality and portability of lc.
  146. X  
  147. X--- 110,116 ----
  148. X  had or will have the same problem.  Please send all "lc" ideas, patches, 
  149. X  etc to 
  150. X  
  151. X! INTERNET: kent@sparky.IMD.Sterling.COM or UUCP: uunet!sparky!kent
  152. X  
  153. X  so that I can continue to improve the functionality and portability of lc.
  154. X  
  155. Xdiff -c ../lc.old/lc.1 ./lc.1
  156. X*** ../lc.old/lc.1    Tue Jan  8 21:23:34 1991
  157. X--- ./lc.1    Tue Jan  8 21:22:27 1991
  158. X***************
  159. X*** 1,4 ****
  160. X! .\" @(#)lc.1    1.1 9/7/90 Kent Landfield;
  161. X  .TH LC 1 "Usenet Source"
  162. X  .SH NAME
  163. X  .B lc 
  164. X--- 1,4 ----
  165. X! .\" @(#)lc.1    1.2 1/8/91 Kent Landfield;
  166. X  .TH LC 1 "Usenet Source"
  167. X  .SH NAME
  168. X  .B lc 
  169. X***************
  170. X*** 46,52 ****
  171. X  is used to switch the column width between 80 and 132 column display.
  172. X  .PP
  173. X  .B lc 
  174. X! has incorporated the minimal the spell checking routines found in the book,
  175. X  The UNIX Programming Environment, by Brian Kernighan and Rob Pike.  
  176. X  .PP
  177. X  If the command line argument list contains more than one name, the 
  178. X--- 46,52 ----
  179. X  is used to switch the column width between 80 and 132 column display.
  180. X  .PP
  181. X  .B lc 
  182. X! has incorporated the minimal spell checking routines found in the book,
  183. X  The UNIX Programming Environment, by Brian Kernighan and Rob Pike.  
  184. X  .PP
  185. X  If the command line argument list contains more than one name, the 
  186. X***************
  187. X*** 127,133 ****
  188. X  .IP "-1"
  189. X  List files one per line instead of in columns.
  190. X  .SH DIAGNOSTICS
  191. X! The "only" options can not be combined at this time.
  192. X  .PP
  193. X  The spell checking does not work when the CDPATH is searched for a
  194. X  file or directory not found in the current directory.
  195. X--- 127,133 ----
  196. X  .IP "-1"
  197. X  List files one per line instead of in columns.
  198. X  .SH DIAGNOSTICS
  199. X! The "only" options can be combined.
  200. X  .PP
  201. X  The spell checking does not work when the CDPATH is searched for a
  202. X  file or directory not found in the current directory.
  203. X***************
  204. X*** 142,147 ****
  205. X  .SH AUTHOR
  206. X  Kent Landfield <kent@sparky.IMD.Sterling.COM>
  207. X  .SH CREDITS
  208. X! Jeff Minnig <jeff@dsndata> and Rick Ohnemus <rick@sparky.IMD.Sterling.COM> 
  209. X! were a *great* help with this program at different stages of its development...
  210. X! Thanks!
  211. X--- 142,160 ----
  212. X  .SH AUTHOR
  213. X  Kent Landfield <kent@sparky.IMD.Sterling.COM>
  214. X  .SH CREDITS
  215. X! 
  216. X! .nr
  217. X! Jeff Minnig <jeff@dsndata>, 
  218. X! .nf
  219. X! .nr
  220. X! Rick Ohnemus <rick@sparky.IMD.Sterling.COM>, 
  221. X! .nf
  222. X! .nr
  223. X! Mike Peterson <root@alchemy.chem.utoronto.ca> and
  224. X! .nf
  225. X! .nr
  226. X! Ivan Fris <neumann.une.oz.au!ivan> 
  227. X! .nf
  228. X! .nf
  229. X! were a *great* help with this program at different stages 
  230. X! of its development...  Thanks!
  231. Xdiff -c ../lc.old/lc.c ./lc.c
  232. X*** ../lc.old/lc.c    Tue Jan  8 21:23:31 1991
  233. X--- ./lc.c    Tue Jan  8 21:20:38 1991
  234. X***************
  235. X*** 48,54 ****
  236. X  **               -l      Mark symbolic links with '@'
  237. X  **               -I      Suppress unresolved symbolic link messages.
  238. X  **
  239. X! ** The "only" options can not be combined.
  240. X  ** If there is no 'directory' specified, the current directory is used.
  241. X  ** Not all options are supported on every system. (e.g. no symbolic links
  242. X  ** on your system ? Options -s, -L or -l won't be available..)
  243. X--- 48,54 ----
  244. X  **               -l      Mark symbolic links with '@'
  245. X  **               -I      Suppress unresolved symbolic link messages.
  246. X  **
  247. X! ** The "only" options can be combined.
  248. X  ** If there is no 'directory' specified, the current directory is used.
  249. X  ** Not all options are supported on every system. (e.g. no symbolic links
  250. X  ** on your system ? Options -s, -L or -l won't be available..)
  251. X***************
  252. X*** 70,79 ****
  253. X  **      Tested with AmigaDOS 1.3 on an Amiga 1000 in 1989.
  254. X  **      Tested with SunOS 4.0.3 on a Sparkstation 1 in 1989.
  255. X  **      Tested with AIX 3.+ on a Risc System/6000 in 1990. 
  256. X  **                                                               
  257. X  */
  258. X  #ifndef lint
  259. X! static char *sccsid = "@(#)lc.c    1.23 9/7/90  Kent Landfield";
  260. X  #endif
  261. X  
  262. X  #include <stdio.h>
  263. X--- 70,80 ----
  264. X  **      Tested with AmigaDOS 1.3 on an Amiga 1000 in 1989.
  265. X  **      Tested with SunOS 4.0.3 on a Sparkstation 1 in 1989.
  266. X  **      Tested with AIX 3.+ on a Risc System/6000 in 1990. 
  267. X+ **      Ivan Fris added the ability to combine "only" options.
  268. X  **                                                               
  269. X  */
  270. X  #ifndef lint
  271. X! static char *sccsid = "@(#)lc.c    1.25 1/2/91  Kent Landfield";
  272. X  #endif
  273. X  
  274. X  #include <stdio.h>
  275. X***************
  276. X*** 143,168 ****
  277. X  #  define S_IXOTH       (S_IEXEC >> 6)
  278. X  #endif
  279. X  
  280. X! #define DIR_ONLY        1
  281. X! #define FILE_ONLY       2
  282. X  #ifdef S_IFCHR
  283. X! #  define CHAR_ONLY     3
  284. X  #endif
  285. X  #ifdef S_IFBLK
  286. X! #  define BLOCK_ONLY    4
  287. X  #endif
  288. X  #ifdef S_IFIFO
  289. X! #  define FIFO_ONLY     5
  290. X  #endif
  291. X  #ifdef S_IFLNK
  292. X! #  define LNK_ONLY      6
  293. X  #endif
  294. X  #ifdef S_IFSOCK
  295. X! #  define SOCK_ONLY     7
  296. X  #endif
  297. X  #ifdef S_IFNAM
  298. X! #  define SEM_ONLY      8
  299. X! #  define SD_ONLY       9
  300. X  #endif
  301. X  
  302. X  #ifdef BSD
  303. X--- 144,169 ----
  304. X  #  define S_IXOTH       (S_IEXEC >> 6)
  305. X  #endif
  306. X  
  307. X! #define DIR_ONLY        1<<0
  308. X! #define FILE_ONLY       1<<2
  309. X  #ifdef S_IFCHR
  310. X! #  define CHAR_ONLY     1<<3
  311. X  #endif
  312. X  #ifdef S_IFBLK
  313. X! #  define BLOCK_ONLY    1<<4
  314. X  #endif
  315. X  #ifdef S_IFIFO
  316. X! #  define FIFO_ONLY     1<<5
  317. X  #endif
  318. X  #ifdef S_IFLNK
  319. X! #  define LNK_ONLY      1<<6
  320. X  #endif
  321. X  #ifdef S_IFSOCK
  322. X! #  define SOCK_ONLY     1<<7
  323. X  #endif
  324. X  #ifdef S_IFNAM
  325. X! #  define SEM_ONLY      1<<8
  326. X! #  define SD_ONLY       1<<9
  327. X  #endif
  328. X  
  329. X  #ifdef BSD
  330. X***************
  331. X*** 499,504 ****
  332. X--- 500,508 ----
  333. X                ind++;
  334. X           }
  335. X           *frmt = '\0';
  336. X+          while (*--frmt == ' ')  /* strip trailing blanks */
  337. X+              *frmt = '\0';
  338. X+         
  339. X           (void) puts(out_str);
  340. X      }
  341. X      return (ind);
  342. X***************
  343. X*** 576,582 ****
  344. X  
  345. X      Current = 0;
  346. X  
  347. X!     if (Lnks.num > 0 && (Disp_links == TRUE || Only == LNK_ONLY)) {
  348. X          ssing = Single;
  349. X          Single = TRUE;
  350. X          Current = LNK_ONLY;
  351. X--- 580,586 ----
  352. X  
  353. X      Current = 0;
  354. X  
  355. X!     if (Lnks.num > 0 && (Disp_links == TRUE || Only & LNK_ONLY)) {
  356. X          ssing = Single;
  357. X          Single = TRUE;
  358. X          Current = LNK_ONLY;
  359. X***************
  360. X*** 586,622 ****
  361. X  #endif
  362. X  
  363. X  #ifdef S_IFSOCK
  364. X!     if (Socks.num > 0 && (Only == 0 || Only == SOCK_ONLY))
  365. X          flag = pr_info("Sockets: ", &Socks, flag, Sort_wanted);
  366. X  #endif
  367. X  
  368. X  #ifdef S_IFNAM
  369. X!     if (Sems.num > 0 && (Only == 0 || Only == SEM_ONLY))
  370. X          flag = pr_info("Semaphore Files: ", &Sems, flag, Sort_wanted);
  371. X  
  372. X!     if (Sds.num > 0 && (Only == 0 || Only == SD_ONLY))
  373. X          flag = pr_info("Shared Data Files: ", &Sds, flag, Sort_wanted);
  374. X  #endif
  375. X  
  376. X  #ifdef S_IFIFO
  377. X!     if (Fifos.num > 0 && (Only == 0 || Only == FIFO_ONLY))
  378. X          flag = pr_info("Fifo Files: ", &Fifos, flag, Sort_wanted);
  379. X  #endif
  380. X  
  381. X  #ifdef S_IFCHR
  382. X!     if (Chrs.num > 0 && (Only == 0 || Only == CHAR_ONLY))
  383. X          flag = pr_info("Character Special Files: ", &Chrs, flag, Sort_wanted);
  384. X  #endif
  385. X  
  386. X  #ifdef S_IFBLK
  387. X!     if (Blks.num > 0 && (Only == 0 || Only == BLOCK_ONLY))
  388. X          flag = pr_info("Block Special Files: ", &Blks, flag, Sort_wanted);
  389. X  #endif
  390. X  
  391. X!     if (Dirs.num > 0 && (Only == 0 || Only == DIR_ONLY))
  392. X          flag = pr_info("Directories: ", &Dirs, flag, Sort_wanted);
  393. X  
  394. X!     if (Fls.num > 0 && (Only == 0 || Only == FILE_ONLY))
  395. X          flag = pr_info("Files: ", &Fls, flag, Sort_wanted);
  396. X  
  397. X      return;
  398. X--- 590,626 ----
  399. X  #endif
  400. X  
  401. X  #ifdef S_IFSOCK
  402. X!     if (Socks.num > 0 && (Only == 0 || Only & SOCK_ONLY))
  403. X          flag = pr_info("Sockets: ", &Socks, flag, Sort_wanted);
  404. X  #endif
  405. X  
  406. X  #ifdef S_IFNAM
  407. X!     if (Sems.num > 0 && (Only == 0 || Only & SEM_ONLY))
  408. X          flag = pr_info("Semaphore Files: ", &Sems, flag, Sort_wanted);
  409. X  
  410. X!     if (Sds.num > 0 && (Only == 0 || Only & SD_ONLY))
  411. X          flag = pr_info("Shared Data Files: ", &Sds, flag, Sort_wanted);
  412. X  #endif
  413. X  
  414. X  #ifdef S_IFIFO
  415. X!     if (Fifos.num > 0 && (Only == 0 || Only & FIFO_ONLY))
  416. X          flag = pr_info("Fifo Files: ", &Fifos, flag, Sort_wanted);
  417. X  #endif
  418. X  
  419. X  #ifdef S_IFCHR
  420. X!     if (Chrs.num > 0 && (Only == 0 || Only & CHAR_ONLY))
  421. X          flag = pr_info("Character Special Files: ", &Chrs, flag, Sort_wanted);
  422. X  #endif
  423. X  
  424. X  #ifdef S_IFBLK
  425. X!     if (Blks.num > 0 && (Only == 0 || Only & BLOCK_ONLY))
  426. X          flag = pr_info("Block Special Files: ", &Blks, flag, Sort_wanted);
  427. X  #endif
  428. X  
  429. X!     if (Dirs.num > 0 && (Only == 0 || Only & DIR_ONLY))
  430. X          flag = pr_info("Directories: ", &Dirs, flag, Sort_wanted);
  431. X  
  432. X!     if (Fls.num > 0 && (Only == 0 || Only & FILE_ONLY))
  433. X          flag = pr_info("Files: ", &Fls, flag, Sort_wanted);
  434. X  
  435. X      return;
  436. X***************
  437. X*** 976,990 ****
  438. X          break;
  439. X  
  440. X      case 'b':
  441. X!         Only = BLOCK_ONLY;
  442. X          break;
  443. X  
  444. X      case 'c':
  445. X!         Only = CHAR_ONLY;
  446. X          break;
  447. X  
  448. X      case 'd':
  449. X!         Only = DIR_ONLY;
  450. X          break;
  451. X  
  452. X      case 'D':
  453. X--- 980,994 ----
  454. X          break;
  455. X  
  456. X      case 'b':
  457. X!         Only |= BLOCK_ONLY;
  458. X          break;
  459. X  
  460. X      case 'c':
  461. X!         Only |= CHAR_ONLY;
  462. X          break;
  463. X  
  464. X      case 'd':
  465. X!         Only |= DIR_ONLY;
  466. X          break;
  467. X  
  468. X      case 'D':
  469. X***************
  470. X*** 996,1002 ****
  471. X          break;
  472. X  
  473. X      case 'f':
  474. X!         Only = FILE_ONLY;
  475. X          break;
  476. X  
  477. X      case 'r':
  478. X--- 1000,1006 ----
  479. X          break;
  480. X  
  481. X      case 'f':
  482. X!         Only |= FILE_ONLY;
  483. X          break;
  484. X  
  485. X      case 'r':
  486. X***************
  487. X*** 1005,1011 ****
  488. X  
  489. X  #ifdef S_IFIFO
  490. X      case 'F':
  491. X!         Only = FIFO_ONLY;
  492. X          break;
  493. X  #endif
  494. X  
  495. X--- 1009,1015 ----
  496. X  
  497. X  #ifdef S_IFIFO
  498. X      case 'F':
  499. X!         Only |= FIFO_ONLY;
  500. X          break;
  501. X  #endif
  502. X  
  503. X***************
  504. X*** 1015,1021 ****
  505. X  
  506. X  #ifdef S_IFLNK
  507. X      case 's':
  508. X!         Only = LNK_ONLY;
  509. X          break;
  510. X  
  511. X      case 'l':
  512. X--- 1019,1025 ----
  513. X  
  514. X  #ifdef S_IFLNK
  515. X      case 's':
  516. X!         Only |= LNK_ONLY;
  517. X          break;
  518. X  
  519. X      case 'l':
  520. X***************
  521. X*** 1033,1049 ****
  522. X  
  523. X  #ifdef S_IFSOCK
  524. X      case 'S':
  525. X!         Only = SOCK_ONLY;
  526. X          break;
  527. X  #endif
  528. X  
  529. X  #ifdef S_IFNAM
  530. X      case 'm':
  531. X!         Only = SD_ONLY;
  532. X          break;
  533. X  
  534. X      case 'M':
  535. X!         Only = SEM_ONLY;
  536. X          break;
  537. X  #endif
  538. X  
  539. X--- 1037,1053 ----
  540. X  
  541. X  #ifdef S_IFSOCK
  542. X      case 'S':
  543. X!         Only |= SOCK_ONLY;
  544. X          break;
  545. X  #endif
  546. X  
  547. X  #ifdef S_IFNAM
  548. X      case 'm':
  549. X!         Only |= SD_ONLY;
  550. X          break;
  551. X  
  552. X      case 'M':
  553. X!         Only |= SEM_ONLY;
  554. X          break;
  555. X  #endif
  556. X  
  557. END_OF_FILE
  558. if test 15399 -ne `wc -c <'lc.patch'`; then
  559.     echo shar: \"'lc.patch'\" unpacked with wrong size!
  560. fi
  561. # end of 'lc.patch'
  562. fi
  563. echo shar: End of shell archive.
  564. exit 0
  565. -- 
  566. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  567. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  568. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  569. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  570.